﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Objects;
using Northwind.NET.Model;
using Northwind.NET.Settings;

namespace Northwind.NET.EDM.FE.WinForms.Controls
{
    public partial class CategoriesUserControl : BaseUserControl
    {
        public CategoriesUserControl()
        {
            InitializeComponent();
        }

        public override string FormCaption     { get { return Settings.Resources.CategoriesFormCaption; } }
        public override dynamic GetEntitySet(ObjectContext context)
        {
            return context.CreateObjectSet<Model.Category>();
        }

        public override BindingSource UserControlBindingSource { get { return categoryBindingSource; } }

         internal override void SetBindingSource()
        {
            // it has to be used here, if BaseUserControl's code is used then
            // picture binding fails
            _context = Globals.CreateObjectContext();
            categoryBindingSource.DataSource = GetEntitySet(_context);
        }
    }
}
